﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CMP.ERP.Model;
using CMP.ERP.Helper;
using System.Data;
using System.Data.SqlClient;

namespace CMP.ERP.DAL
{
    public class PandiandanDAL
    {
        SQLHelper h = new SQLHelper();
        /// <summary>
        /// 显示盘点单
        /// </summary>
        /// <returns></returns>
        public DataTable GetPandianList()
        {
            string procname = "Proc_PandianShow";
            return h.ExecDataTable_Proc(procname);
        }
        /// <summary>
        /// 添加盘点单
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public int AddPandian(PandianList p)
        {
            string procname = "Proc_AddPandian";
            SqlParameter[] parameter = new SqlParameter[]
            {
                new SqlParameter("@ShangpinName",p.ShangpinName),
                new SqlParameter("@CangkuName",p.CangkuName),
                new SqlParameter("@PandianqianNum",p.PandianqianNum),
                new SqlParameter("@PandianhouNum",p.PandianhouNum),
                new SqlParameter("@BeiZhu",p.BeiZhu),
                new SqlParameter("@Stock_Id",p.Stock_Id)
            };
            return h.ExecNonquery_Proc(procname, parameter);
        } 
        public int Del(int id)
        {
            string procname = "Proc_DelPandian";
            SqlParameter[] par = new SqlParameter[1]
            {
                new SqlParameter("@PandianId",id)
            };
            return h.ExecNonquery_Proc(procname, par);
        }
    }
}
